package com.belizer.demo.threadpool;

import java.util.concurrent.*;

public class Demo {

    public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(5);

        for(int i = 0; i < 100; i++){
            executorService.execute(new DivTask(100,i));
        }

        executorService.shutdown();
    }

    static class DivTask implements Runnable {
        int a, b;

        public DivTask(int a, int b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public void run() {
            double result = a * b;
            System.out.println(result);
        }
    }

}
